package com.rpay.dao.sms;

import com.rpay.model.sms.SmsCodeDO;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

/**
 * Title：
 * Description
 *
 * @author fxg06 on 2018/4/30
 * @version 1.0
 */
@Repository
public class SmsCodeDao {

    @Autowired
    @Qualifier("readSqlSession")
    private SqlSessionTemplate readSqlSession;

    @Autowired
    @Qualifier("writeSqlSession")
    private SqlSessionTemplate writeSqlSession;
    
    public int insert(SmsCodeDO smsCodeDO) {
        return writeSqlSession.insert("rpay.smsCode.insert", smsCodeDO);
    }

    public SmsCodeDO select(SmsCodeDO smsCodeDO) {
        return readSqlSession.selectOne("rpay.smsCode.select", smsCodeDO);
    }

    public int updateValid(Integer id) {
        return writeSqlSession.update("rpay.smsCode.updateValid", id);
    }
}
